﻿//-----------------------------------------------------------------------
// <copyright file="App.xaml.cs" author="Artak Mkrtchyan">
//     Creative Commons - GNU General Public License (http://creativecommons.org/licenses/GPL/2.0/
// </copyright>
// <author>Artak Mkrtchyan</author>
// <email>mkArtak@gmail.com</email>
// <date>20/03/2013</date>

using System;
using System.Windows;

namespace AppUpdateInstaller
{
	/// <summary>
	/// Interaction logic for App.xaml
	/// </summary>
	public partial class App : Application
	{
		public App()
		{
			AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
		}

		protected override void OnStartup(StartupEventArgs e)
		{
			MainWindow tmpWindow = new MainWindow(e.Args);
			tmpWindow.Show();
		}

		private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
		{
			string tmpMessage = String.Format("Failed to update the application. Reason: {0}", (e.ExceptionObject as Exception).ToString());
			MessageBox.Show(tmpMessage);
		}
	}
}
